<template>
  <div class="ei_record elm-edit" v-if="model!=''">
  <el-tabs v-model="activeName">
    <el-tab-pane label="个人信息" name="个人信息">
      <el-card  shadow="hover">
        <div slot="header">
          <span>基础信息</span>
          <elm-open-button url="ei_edit" title="编辑"   width="900" height="700" :data="{ model: model,p:'ei_record' }" type="text"  style="float: right; padding: 3px 0">编辑</elm-open-button>
        </div>
        <div style="background-color:#DBDBDB;width: 150px;height: 194px;position: absolute;right: 5px;top:5px;z-index: 1;border: #CCCCCC 1px solid">
          <img :src='"/api/system/login/io/Viewer/biz_hrm_ei_basic_avatar/"+model.id+"?token="+elm.info.token'
               style="width: 146px;height: 190px;margin-left: 2px;margin-top: 2px;" />
        </div>
        <el-form size="small" label-width="120px">
          <elm-row>
            <el-form-item label="工号">
              {{model.emp_code}}
            </el-form-item>
            <el-form-item label="姓名">
              <span style="margin-right:150px; ">{{model.name}}</span>
            </el-form-item>
          </elm-row>
          <el-form-item label="所在部门">
            <span style="margin-right:150px; ">
            <el-tag v-for="item in orgs" style="margin: 3px" :disable-transitions="true">
                <span style="margin-right: 5px;">{{item.name}}</span>
                <span style="margin-right: 5px;" v-if="item.fzr==1">|</span>
                <span style="margin-right: 5px;" v-if="item.fzr==1">负责人</span>
                <span style="margin-right: 5px;" v-if="item.pm==1">|</span>
                <span v-if="item.pm==1">主部门</span>
            </el-tag>
              </span>
          </el-form-item>
          <elm-row>
            <el-form-item label="性别">
              {{model.sex}}
            </el-form-item>
            <el-form-item label="民族">
              <span style="margin-right:150px; ">{{model.nation}}</span>
            </el-form-item>
          </elm-row>
          <elm-row>
            <el-form-item label="身份证号">
              {{model.id_card}}
            </el-form-item>
            <el-form-item label="出生日期">
              <span style="margin-right:150px; ">{{model.birthday}}</span>
            </el-form-item>
          </elm-row>
          <el-form-item label="联系电话">
            <span style="margin-right:150px; ">
            <el-tag v-for="phone in phones" style="margin: 3px" :disable-transitions="true">
                {{phone}}
            </el-tag>
            </span>
          </el-form-item>
          <el-form-item label="家庭住址">
            {{model.home_address}}
          </el-form-item>
          <elm-row>
            <el-form-item label="婚姻状况">
              {{model.marital_status}}
            </el-form-item>
            <el-form-item label="政治面貌">
              {{model.politics_status}}
            </el-form-item>
          </elm-row>
          <elm-row>
            <el-form-item label="用工状态">
              {{model.work_status}}
            </el-form-item>
            <el-form-item label="入职时间">
              {{model.enter_company_date}}
            </el-form-item>
          </elm-row>
          <elm-row>
            <el-form-item label="参加工作时间" prop="work_date">
              {{model.work_date}}
            </el-form-item>
            <el-form-item label="学历">
              {{model.education}}
            </el-form-item>
          </elm-row>
          <el-form-item label="备注">
            {{model.remark}}
          </el-form-item>
        </el-form>
      </el-card>

      <el-card  shadow="hover">
        <div slot="header">
          <span>个人技能</span>
          <elm-open-button url="ei_extend" title="个人技能"   width="900" height="700" :data="{ei_id: model.id,type:'个人技能'}" type="text"  style="float: right; padding: 3px 0">编辑</elm-open-button>
        </div>
        <el-tag v-for="extend in extend_个人技能" style="margin: 3px" :disable-transitions="true">
          {{extend.text}}
        </el-tag>
      </el-card>

      <el-card  shadow="hover">
        <div slot="header">
          <span>教育背景</span>
          <elm-open-button url="ei_career" title="教育背景"   width="900" height="700" :data="{ei_id: model.id,type:'教育背景'}" type="text"  style="float: right; padding: 3px 0">编辑</elm-open-button>
        </div>
        <el-form size="small" label-width="120px" v-for="career in career_教育背景" style="margin-bottom: 10px;" >
          <elm-row>
            <el-form-item label="开始日期">
              {{career.sdate}}
            </el-form-item>
            <el-form-item label="结束日期">
              {{career.edate}}
            </el-form-item>
          </elm-row>
          <elm-row>
            <el-form-item label="学校名称">
              {{career.org}}
            </el-form-item>
            <el-form-item label="学习专业">
              {{career.major}}
            </el-form-item>
          </elm-row>
          <elm-row>
            <el-form-item label="学历">
              {{career.diploma}}
            </el-form-item>
            <el-form-item label="备注">
              {{career.remark}}
            </el-form-item>
          </elm-row>
          <el-form-item label="主修课程">
            {{career.results}}
          </el-form-item>
        </el-form>
      </el-card>

      <el-card  shadow="hover">
        <div slot="header">
          <span>过往工作</span>
          <elm-open-button url="ei_career" title="过往工作"   width="900" height="700" :data="{ei_id: model.id,type:'过往工作'}" type="text"  style="float: right; padding: 3px 0">编辑</elm-open-button>
        </div>
        <el-form size="small" label-width="120px" v-for="career in career_过往工作" style="margin-bottom: 10px;" >
          <elm-row>
            <el-form-item label="开始日期">
              {{career.sdate}}
            </el-form-item>
            <el-form-item label="结束日期">
              {{career.edate}}
            </el-form-item>
          </elm-row>
          <elm-row>
            <el-form-item label="工作单位">
              {{career.org}}
            </el-form-item>
            <el-form-item label="担任职务">
              {{career.major}}
            </el-form-item>
          </elm-row>
          <el-form-item label="主要业绩">
            {{career.results}}
          </el-form-item>
        </el-form>
      </el-card>

      <el-card  shadow="hover">
        <div slot="header">
          <span>曾获荣誉</span>
          <elm-open-button url="ei_extend" title="曾获荣誉"   width="900" height="700" :data="{ei_id: model.id,type:'曾获荣誉'}" type="text"  style="float: right; padding: 3px 0">编辑</elm-open-button>
        </div>
        <el-tag v-for="extend in extend_曾获荣誉" style="margin: 3px" :disable-transitions="true">
          {{extend.text}}
        </el-tag>
      </el-card>
    </el-tab-pane>
<!--    <el-tab-pane label="工作信息" name="工作信息">-->
<!--      工作信息&#45;&#45;工龄-&#45;&#45;当前职务-&#45;&#45;-->
<!--      内部调动-->
<!--      合同信息-->
<!--      参与工作-->
<!--      出差信息&#45;&#45;当前状态出差中还是在司-->
<!--      假期信息&#45;&#45;剩余假期，总假期&#45;&#45;事假，病假等统计-->
<!--      学习培训-->
<!--      账号信息-->
<!--    </el-tab-pane>-->

    <el-tab-pane label="证书职称" name="证书职称">
      <el-card  shadow="hover">
        <div slot="header">
          <span>资格证书</span>
          <elm-open-button url="ei_credentials" title="资格证书"   width="900" height="700" :data="{ei_id: model.id,type:'资格证书'}" type="text"  style="float: right; padding: 3px 0">编辑</elm-open-button>
        </div>
          <el-form size="small" label-width="120px"  v-for="credentials in credentials_资格证书" style="margin-bottom: 10px;">
            <elm-row>
              <el-form-item label="证书名称">
                {{credentials.name}}
              </el-form-item>
              <el-form-item label="编号">
                {{credentials.cred_key}}
              </el-form-item>
            </elm-row>
            <elm-row>
              <el-form-item label="发证机构">
                {{credentials.cred_org}}
              </el-form-item>
              <el-form-item label="签发日期">
                {{credentials.cred_date}}
              </el-form-item>
            </elm-row>
            <elm-row>
              <el-form-item label="起始有效期">
                {{credentials.valid_sdate}}
              </el-form-item>
              <el-form-item label="截止有效期">
                {{credentials.valid_edate}}
              </el-form-item>
            </elm-row>
          </el-form>
      </el-card>
      <el-card  shadow="hover">
        <div slot="header">
          <span>专业职称</span>
          <elm-open-button url="ei_credentials" title="专业职称"   width="900" height="700" :data="{ei_id: model.id,type:'专业职称'}" type="text"  style="float: right; padding: 3px 0">编辑</elm-open-button>
        </div>
        <el-form size="small" label-width="120px"  v-for="credentials in credentials_专业职称" style="margin-bottom: 10px;">
          <elm-row>
            <el-form-item label="职称名称">
              {{credentials.name}}
            </el-form-item>
            <el-form-item label="编号">
              {{credentials.cred_key}}
            </el-form-item>
          </elm-row>
          <elm-row>
            <el-form-item label="发证机构">
              {{credentials.cred_org}}
            </el-form-item>
            <el-form-item label="签发日期">
              {{credentials.cred_date}}
            </el-form-item>
          </elm-row>
          <elm-row>
            <el-form-item label="起始有效期">
              {{credentials.valid_sdate}}
            </el-form-item>
            <el-form-item label="截止有效期">
              {{credentials.valid_edate}}
            </el-form-item>
          </elm-row>
            <elm-row>
              <el-form-item label="专业">
                {{credentials.major}}
              </el-form-item>
              <el-form-item label="备注">
                {{credentials.remark}}
              </el-form-item>
            </elm-row>
        </el-form>
      </el-card>
    </el-tab-pane>
<!--    <el-tab-pane label="绩效薪酬" name="绩效薪酬">-->
<!--      成本信息（年化成本，所有口径，总成本&#45;&#45;已花成本）-->
<!--      社保信息-->
<!--      绩效信息-->
<!--      工资薪酬-->
<!--    </el-tab-pane>-->
<!--    <el-tab-pane label="健康状况" name="员工健康">-->
<!--      健康状况&#45;&#45;打分-评估结果，健康指南，工作胜任情况-->
<!--      体检报告-->
<!--    </el-tab-pane>-->
<!--    <el-tab-pane label="评价标签" name="评价标签">-->
<!--      个我评价-->
<!--      评价标签-->
<!--      能力雷达-->
<!--      奖惩信息-->
<!--    </el-tab-pane>-->
  </el-tabs>
  </div>
</template>
<script>
export default {
  extends: elmVueBase,
  data() {
    return {
      activeName:"个人信息",
      orgs:[],
      phones:[],
      extend_个人技能:[],
      extend_曾获荣誉:[],
      career_教育背景:[],
      career_过往工作:[],
      credentials_资格证书:[],
      credentials_专业职称:[],
    }
  },
  async created() {
    if(this.model.id== undefined)
    {
      this.model = await elm.post('/business/my/GetEIBasic');
      if(this.model=="")
      {
        return;
      }
    }
    this.init();
    this.init_extend("个人技能");
    this.init_extend("曾获荣誉");
    this.init_career("教育背景");
    this.init_career("过往工作");
    this.init_credentials("资格证书");
    this.init_credentials("专业职称");
  },
  methods: {
    async init(model)
    {
      if(model!=undefined)
      {
        this.model=model;
      }
      this.phones=(this.model.phone==null || this.model.phone=='') ?[]:this.model.phone.split(",");
      var res = await elm.post('/business/hrm/ei/GetOrgs', {"ei_id": this.model.id });
      this.orgs=res;
    },
    async init_extend(type)
    {
      this["extend_"+type] = await elm.post('/business/hrm/ei/extend/GetData', {"ei_id": this.model.id,type:type });
    },
    async init_career(type)
    {
      this["career_"+type] = await elm.post('/business/hrm/ei/career/GetData', {"ei_id": this.model.id,type:type });
    },
    async init_credentials(type)
    {
      this["credentials_"+type] = await elm.post('/business/hrm/ei/credentials/GetData', {"ei_id": this.model.id,type:type });
    }
  }
}
</script>
<style>
.ei_record .el-tabs
{
  background-color: #fff;
  border-radius: 6px;
}
.ei_record .el-tabs__nav
{
  margin-left: 15px;
}
.ei_record .el-tabs__header {
  margin: 0px;
}
.ei_record .el-tabs
{
  position:absolute;
  left: 0px;
  right: 0px;
  bottom: 0px;
  top: 0px;
}
.ei_record .el-tabs__content
{
  position:absolute;
  left: 0px;
  right: 0px;
  bottom: 0px;
  top: 40px;
  overflow: auto;
}

.ei_record .el-tab-pane
{
  overflow: auto;
}
.ei_record .el-tag {
  height: auto;
  white-space: normal;
  background-color: transparent;
  color: #333;
  border-color: #DBDBDB;
}
.ei_record .el-card__body .el-form:last-child{
  margin-bottom:0px !important;
}
</style>